Repository navigation
fix(network): fail when open mode cannot enforce block_metadata_endpoint - #1201
Draft
coipond-coder[bot] wants to merge 5 commits into
Draft
coipond-coder[bot] wants to merge 5 commits into
coipond-coder[bot] wants to merge 5 commits into
Conversation
With block_metadata_endpoint on, open mode warned and started the container when the metadata reject could not be installed (no usable nft, no container IP, nft failed). coi shell, coi run and coi container start now fail with the reason and the fix, and stop the container.
…he open-mode stops Install and health --fix texts say open mode without nft needs block_metadata_endpoint = false. coi shell skips the boot-block removal without usable nft. Tests: container start/launch stop, the open-mode health message.
… shell setup stopOpenUnisolated checks NftUsable with the network config, so use_sudo = false skips the removal too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Redmine: 54627
Summary
With
block_metadata_endpoint = true(the default), open mode used to warn and start the container when it could not install the 169.254.0.0/16 reject. Now it refuses to start, with the reason and the fix:coi shell/coi container start(Manager.SetupForContainer): returns an error when nft is not usable (use_sudo = false, nft not installed, no passwordless sudo for it), when there is no container IP, or when the nft rules fail. The iptables fallback runs only with the block off. The boot block stays.coi shellstops the container, because open mode's boot block is best effort and may not be in place; it removes the boot block only when nft is usable.coi container startalready stops it (stopUnisolated).coi run(ApplyOpenMetadataBlock): returns the same error instead of warnings. The run pipeline deletes the container.coi health --fix, do not setuse_sudo = false, or setblock_metadata_endpoint = falsein trusted config.errNftNotAvailable's "use open mode" hint now addsblock_metadata_endpoint = false.Manager.MetadataUnenforcedand the grants check that used it: a successful open-mode setup now always has the reject when the setting is on.coi health: the nft check passes open mode only whenblock_metadata_endpoint = false. Otherwise it checks nft as for restricted mode (use_sudo=false: warning that points at the setting). The Colima hints addblock_metadata_endpoint = false, and so do theinstall.shnft prompts and thecoi health --fixnft summary.block_metadata_endpoint,use_sudo) and the starter config are updated.Setups this stops (default
block_metadata_endpoint = true)use_sudo = falseFix for each: make nft usable (
sudo apt install nftables,coi health --fix, keepuse_sudoon), or setblock_metadata_endpoint = falsein~/.coi/config.toml.Tests
TestSetupForContainer_OpenMetadataNoNft,TestSetupForContainer_OpenMetadataRulesFail(network): the error, its reason, and the boot block kept.TestPhaseSetupNetwork_OpenMetadataNotEnforced(session,coi shell): no usable nft, nft not installed and failed nft rules stop the container, with no boot-block warning when nft is missing. A restricted failure does not stop it.TestContainerStartLaunch_OpenMetadataNotEnforcedStops(cli):coi container startandlaunchstop the container.TestApplyNetworkIsolation_OpenMetadataBlock(cli,coi run): no usable nft and failed nft rules return the error and no teardown.TestApplyOpenMetadataBlock_NoNft,TestCheckNft_UseSudoFalse(health case added).tests/run/run_open_metadata_block_needs_nft.py(open +use_sudo = false, default block):coi runfails, the command does not run, the error names the reason and the fix, and the container is deleted.tests/network/test_no_sudo_mode.py: the open-mode tests setblock_metadata_endpoint = false. A new health case checks the warning.test_no_sudo_mode.pywere run locally against the built binary: pass.Local: gofmt, go vet, golangci-lint (0 issues),
go test -short -race ./..., ruff,check-ci-coverage.py: pass.Performance impact
none. Only the failure paths change. A successful open-mode setup makes the same nft and Incus calls as before.